#ifndef _CONVERT_H_
#define _CONVERT_H_

#include <d3dx9.h>
#include <string>
#include <sstream>
using namespace std;

#define TILE_RESOURCE(A,B) (A + L"//" + B + L".png")
#define TILE_FILE(angel) ((LPCTSTR)wcscat((LPCTSTR)A,(LPCTSTR)L"//.txt"))

#define VECTOR3 D3DXVECTOR3
#define PI 3.1457




enum EnemyName {
	ENEMY_SOLDIER				= 0,
	ENEMY_CANON_RED,
	ENEMY_CANON_WHITE,
	ENEMY_BOX,

	SOLDIER_STAND_SHOOT,
	SOLDIER_WATER_SHOOT,
	SOLDIER_HIDE_SHOOT,
	SOLDIER_RUNNING_MAN,

	NUMBER_OF_ENEMIES
};

enum TileName {
	TILE						= 0,
	NUMBER_OF_TILES
};

enum PlayerStatus {
	STAND						= 0,
	WALK,
	JUMP,
	SWIM,
	DIE,
	SHOOT,
	SHOOT_UP,
	SHOOT_UP45,
	SHOOT_DOWN45,
	SHOOT_DOWN,
	NUMBER_OF_STATUS
};

enum WhiteCanonStatus {
	WHITE_1						= 0,
	WHITE_2,
	WHITE_3,
	WHITE_4,
	WHITE_5,
	WHITE_6,
	WHITE_7,
	WHITE_8,
	WHITE_9,
	WHITE_10,
	WHITE_11,
	WHITE_12,
	WHITE_OPEN,
	WHITE_CLOSE,
	NUMBER_OF_WHITE
};


// Enum description of Soldiers. Number of status = 
enum SoldierStatus{
	SOLDIER_STAND = 0,
	SOLDIER_WALK,
	SOLDIER_JUMP,
	SOLDIER_HIDE,

	SOLDIER_SHOOT_LEFT_UP = 4,								// 0   --> 30   deg
	SOLDIER_SHOOT_LEFT_DOWN,								// 330 --> 360  deg
	SOLDIER_SHOOT_RIGHT_UP,									// 150 --> 180  deg
	SOLDIER_SHOOT_RIGHT_DOWN,								// 180 --> 210  deg

	SOLDIER_SHOOT_LEFT_TOP = 8,								// 30  --> 60   deg
	SOLDIER_SHOOT_LEFT_LEFT_TOP,							// 60  --> 90   deg
	SOLDIER_SHOOT_RIGHT_RIGHT_TOP,							// 90  --> 120  deg
	SOLDIER_SHOOT_RIGHT_TOP,								// 120 --> 150	deg

	SOLDIER_SHOOT_LEFT_BOT = 12,							// 300 --> 330  deg
	SOLDIER_SHOOT_LEFT_LEFT_BOT,							// 270 --> 300  deg
	SOLDIER_SHOOT_RIGHT_BOT,								// 210 --> 240  deg
	SOLDIER_SHOOT_RIGHT_RIGHT_BOT,							// 240 --> 270  deg

	SOLDIER_DIE = 16,
	SOLDIER_NUMBER_OF_STATUS = 17
};

enum RunningMan
{
	RUNNINGMAN_DIE,
	RUNNINGMAN_JOG,
	RUNNINGMAN_JUMP,
	RUNNINGMAN_NUMBER_OF_STATUS
};

enum Direction
{
	LEFT						= 0,
	RIGHT,
	UP,
	DOWN
};

enum BoxStatus {
	BOX_CLOSED					= 0,
	BOX_OPENNING,
	BOX_OPEN,
	NUMBER_OF_BOXES
};

class CConvert
{
public:
	CConvert();
	~CConvert();
	static EnemyName toEnemyName(wstring name)
	{
		if (name == L"CanonRed")
			return EnemyName::ENEMY_CANON_RED;
		if (name == L"CanonWhite")
			return EnemyName::ENEMY_CANON_WHITE;
		if (name == L"Box")
			return EnemyName::ENEMY_BOX;
		if (name == L"StandShoot")
			return EnemyName::SOLDIER_STAND_SHOOT;
		if (name == L"WaterShoot")
			return EnemyName::SOLDIER_WATER_SHOOT;
		if (name == L"HideShoot")
			return EnemyName::SOLDIER_HIDE_SHOOT;
		if (name == L"RunningMan")
			return EnemyName::SOLDIER_RUNNING_MAN;
	}

	static TileName toTileName(wstring name)
	{
		return TileName::TILE;
	}
	

	static RECT* createRect(float left, float right, float top, float bottom)
	{
		RECT* temp = new RECT();
		temp->left = left;
		temp->right = right;
		temp->top = top;
		temp->bottom = bottom;
		return temp;
	}
};
#endif